<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ShopProductWriter
 *
 * @author boszdigital
 */


class ShopProductWriter {

    private $products = array();

    public function addProduct(ShopProduct $shopProduct) {
        $this->products[] = $shopProduct;
    }

    public function write() { //class type hint(ShopProduct) used to enforce the method to only accept that type
        $str='';
        foreach ($this->products as $shopProduct) {
            $str = "{$shopProduct->title}:";
            $str.=$shopProduct->getProducer();
            $str = "({$shopProduct->price}\n";
        }


        print $str;
    }

}

?>
